﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Runtime.Serialization;
using Shared;
using System.IO;

namespace PassCustomDataInWCFHeaderApp
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                using (var service = new ServiceReference1.Service1Client())
                {
                    Console.WriteLine(service.GetData(5));
                    Console.Read();
                }
            }
            catch (Exception ex)
            {
                DataContractSerializer s = new DataContractSerializer(typeof(DefaultFaultContract));
                MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(ex.Message));
                DefaultFaultContract d = (DefaultFaultContract)s.ReadObject(ms);
            }
        }
    }
}
